package sg.edu.nus.iss.vmcs.customer;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


/**
* This class represents the control object that monitors the Terminate Button 
* on the Customer Panel and informs the Transaction Controller when it is pressed.
* It implements the ActionListener from Java AWT Event package.
*
*/

public class TerminateButtonListener implements ActionListener {

	private  TransactionController transCtrl;

/**
 *  This constructor creates an instance of the Terminate Button Listener. It
 *  receives the reference for the Transaction Controller object as a parameter.
 * @param tCtrl Transaction Controller
 * @see TransactionController
 */	
	public TerminateButtonListener(TransactionController tCtrl) {
		transCtrl = tCtrl;
	}

/**
 * Invoked when an action occurs in response to the button being pressed. 
 * Implemented as a part of interface.
 * @param e ActionEvent 
 * @see TransactionController#cancelTransaction()
 */	
	public void actionPerformed(ActionEvent e) {
		transCtrl.cancelTransaction();	
	}
}
